package com.example.administrator.tiyuapp.HeaderFragment.Bean;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;

/**
 * Created by Ved on 2017/1/17.
 */
public class DynamicBean {

    /**
     * id : 2349
     * source_type : 2
     * source_data : {"nick_name":"山东鲁能","url_type":0,"avatar":"3f4/1483949554648_xm78yc.jpg","click_flag":true,"url":"http://m.weibo.cn/1911180293/Eq0zRhyHT?jumpfrom=weibocom"}
     * text : 2017，继续练，一句话，就是干！[给力]
     * image : d6d/1483949562932_d4e6rf.jpg
     * images : ["d6d/1483949562932_d4e6rf.jpg","838/1483949563648_sce4fb.jpg","1da/1483949564336_r6zi82.jpg","b15/1483949566001_rr4mxc.jpg"]
     * content_type : 0
     * video_type : 2
     * video_link :
     * create_time : Mon Jan 09 16:13:02 +0800 2017
     * editor : 李超
     * update_time : Mon Jan 09 16:13:02 +0800 2017
     * source_data_obj : {"avatar":"3f4/1483949554648_xm78yc.jpg","url":"http://m.weibo.cn/1911180293/Eq0zRhyHT?jumpfrom=weibocom","nick_name":"山东鲁能","click_flag":true,"url_type":0}
     * category_index : 0
     */

    private int id;
    private int source_type;
    private String source_data;
    private String text;
    private String image;
    private int content_type;
    private int video_type;
    private String video_link;
    private String create_time;
    private String editor;
    private String update_time;
    private SourceDataObjBean source_data_obj;
    private int category_index;
    private List<String> images;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getSource_type() {
        return source_type;
    }

    public void setSource_type(int source_type) {
        this.source_type = source_type;
    }

    public String getSource_data() {
        return source_data;
    }

    public void setSource_data(String source_data) {
        this.source_data = source_data;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getImage() {
        return "http://lifeixphoto.qiniudn.com/"+image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public int getContent_type() {
        return content_type;
    }

    public void setContent_type(int content_type) {
        this.content_type = content_type;
    }

    public int getVideo_type() {
        return video_type;
    }

    public void setVideo_type(int video_type) {
        this.video_type = video_type;
    }

    public String getVideo_link() {
        return video_link;
    }

    public void setVideo_link(String video_link) {
        this.video_link = video_link;
    }

    public String getCreate_time() {
        return create_time;
    }

    public void setCreate_time(String create_time) {
        this.create_time = create_time;
    }

    public String getEditor() {
        return editor;
    }

    public void setEditor(String editor) {
        this.editor = editor;
    }

    public String getUpdate_time() {
        Date date = null;

        try {
            date = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy", Locale.ENGLISH).parse(update_time.replace("+8","-6"));
        } catch (ParseException e) {
            e.printStackTrace();
        }

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd HH:mm",Locale.CHINA);

        return simpleDateFormat.format(date);
    }

    public void setUpdate_time(String update_time) {
        this.update_time = update_time;
    }

    public SourceDataObjBean getSource_data_obj() {
        return source_data_obj;
    }

    public void setSource_data_obj(SourceDataObjBean source_data_obj) {
        this.source_data_obj = source_data_obj;
    }

    public int getCategory_index() {
        return category_index;
    }

    public void setCategory_index(int category_index) {
        this.category_index = category_index;
    }

    public List<String> getImages() {
        return images;
    }

    public void setImages(List<String> images) {
        this.images = images;
    }

    public static class SourceDataObjBean {
        /**
         * avatar : 3f4/1483949554648_xm78yc.jpg
         * url : http://m.weibo.cn/1911180293/Eq0zRhyHT?jumpfrom=weibocom
         * nick_name : 山东鲁能
         * click_flag : true
         * url_type : 0
         */

        private String avatar;
        private String url;
        private String nick_name;
        private boolean click_flag;
        private int url_type;

        public String getAvatar() {
            return "http://7xavvq.com2.z0.glb.qiniucdn.com/"+avatar;
        }

        public void setAvatar(String avatar) {
            this.avatar = avatar;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getNick_name() {
            return nick_name;
        }

        public void setNick_name(String nick_name) {
            this.nick_name = nick_name;
        }

        public boolean isClick_flag() {
            return click_flag;
        }

        public void setClick_flag(boolean click_flag) {
            this.click_flag = click_flag;
        }

        public String getUrl_type() {
            return url_type==0?"来自微博":"来自秒拍";
        }

        public void setUrl_type(int url_type) {
            this.url_type = url_type;
        }
    }
}
